home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_02
/
8n02109a
< prev
next >
Wrap
Text File
|
1990-02-28
|
10KB
|
319 lines
*****Listing 2*****
/**
***
*** CUG.C
*** November 17, 1989 : C:\CUG\CUG , VEDTMNBT
***
*** (Calls functions defined in Vermont Views Interface Library)
***
**/
/* Author: Paul Combellick , The Computer Catalyst, (602) 280-2569 */
#include <string.h>
#include <vv_menu.h> /* Vermont Views Header File. */
#include <vv_str.h> /* Vermont Views Header File. */
#include <vv_bool.h> /* Vermont Views Header File. */
#include <vv_sys.h> /* Vermont Views Header File. */
#include <vv_date.h> /* Vermont Views Header File. */
#include <vv_time.h> /* Vermont Views Header File. */
#include <vv_long.h> /* Vermont Views Header File. */
#include <vv_form.h> /* Vermont Views Header File. */
#include <vv_help.h> /* Vermont Views Header File. */
/* declare external variables. */
/* BOX: extern does not exist */
extern char *name;
extern char *address;
extern char *city;
extern char *state;
extern char *zip;
extern char *phone;
extern char *fax;
#ifdef LINT_ARGS
extern int act_return(MFORMPTR);
extern int act_bell( MFORMPTR );
extern int act_SAMELEVEL( void );
int CUG (void);
int addCUG (void);
extern int delCUG (void);
int editCUG (void);
extern int findCUG (void);
extern int nextCUG (void);
extern int prevCUG (void);
int quitCUG (void);
extern int gotopCUG (void);
extern int insertCUG (void);
extern int updateCUG (void);
int blankCUG (void);
extern int openCUG (void);
extern int closeCUG (void);
extern int readCUG (void);
extern int unlockCUG (void);
#else
extern int act_return();
extern int act_bell();
extern int act_SAMELEVEL();
int CUG ();
int addCUG ();
extern int delCUG ();
int editCUG ();
extern int findCUG ();
extern int nextCUG ();
extern int prevCUG ();
int quitCUG ();
extern int gotopCUG ();
extern int insertCUG ();
extern int updateCUG ();
int blankCUG ();
extern int openCUG ();
extern int closeCUG ();
extern int readCUG ();
extern int unlockCUG ();
#endif
/* declare form pointer variables */
DFORMPTR CUG_dfmp ; /* pointer to the form */
/* declare a pointers to each field */
DFIELDPTR CUG_fld1;
DFIELDPTR CUG_fld2;
DFIELDPTR CUG_fld3;
DFIELDPTR CUG_fld4;
DFIELDPTR CUG_fld5;
DFIELDPTR CUG_fld6;
DFIELDPTR CUG_fld7;
/* declare menu pointer variables */
MFORMPTR CUG_mfmp ; /* pointer to the menu */
/* declare a pointers to each menu option */
MFIELDPTR CUG_mn1;
MFIELDPTR CUG_mn2;
MFIELDPTR CUG_mn3;
MFIELDPTR CUG_mn4;
MFIELDPTR CUG_mn5;
MFIELDPTR CUG_mn6;
MFIELDPTR CUG_mn7;
/************************ BEGIN: CUG() ***********************
* CUG:
*/
CUG()
{
blankCUG(); /* blank all data field vars */
if( openCUG() != 0 ) /* open btrieve file (s). */
{
return;
}
gotopCUG(); /* get first key in file */
/*********************** define the form ***************************/
/* define a form */
CUG_dfmp = fm_def( 0, 0, 21,80, LNORMAL, BDR_NULLP );
/* define boxes around form items ****/
bg_boxdef( 0,0,21,80,LNORMAL,BDR_SPACEP,CUG_dfmp);
bg_boxdef( 5,14,11,52,LNORMAL,BDR_DLNP,CUG_dfmp);
/*********** define background text */
bg_txtdef( 1, 28, "C USER'S GROUP UI2 DEMO", LNORMAL, CUG_dfmp);
bg_txtdef( 2, 28, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓", LNORMAL, CUG_dfmp);
bg_boxdef( 5,14,11,52,LNORMAL,BDR_DLNP, CUG_dfmp);
bg_txtdef( 7, 19, "Name : [ ]", LNORMAL,
CUG_dfmp);
bg_txtdef( 8, 19, "Address : [ ]", LNORMAL,
CUG_dfmp);
bg_txtdef( 9, 19, "City : [ ]", LNORMAL,
CUG_dfmp);
bg_txtdef( 10, 19, "State : [ ] Zip : [ - ]", LNORMAL,
CUG_dfmp);
bg_txtdef( 12, 19, "Phone : [ ]", LNORMAL, CUG_dfmp);
bg_txtdef( 13, 19, "Fax : [ ]", LNORMAL, CUG_dfmp);
sfm_help( "*DATA HELP" , CUG_dfmp ); /* define form help keyword */
/******* define form data fields *********/
CUG_fld1 = fld_def( 7,33, NULLP , FADJACENT , "!!!!!!!!!!!!!!!!!!!!!!!!!",
F_STRING , (PTR) name, CUG_dfmp );
CUG_fld2 = fld_def( 8,33, NULLP , FADJACENT , "XXXXXXXXXXXXXXXXXXXXXXXXX" ,
F_STRING , (PTR) address, CUG_dfmp );
CUG_fld3 = fld_def( 9,33, NULLP , FADJACENT , "XXXXXXXXXXXXXXXXXXXXXXXXX" ,
F_STRING , (PTR) city, CUG_dfmp );
CUG_fld4 = fld_def( 10,33, NULLP , FADJACENT , "!!", F_STRING ,
(PTR) state, CUG_dfmp );
CUG_fld5 = fld_def( 10,48, NULLP , FADJACENT , "UUUUU-UUUU", F_STRING ,
(PTR) zip, CUG_dfmp );
CUG_fld6 = fld_def( 12,33, NULLP , FADJACENT , "(UUU)UUU-UUUU", F_STRING ,
(PTR) phone, CUG_dfmp );
CUG_fld7 = fld_def( 13,33, NULLP , FADJACENT , "(UUU)UUU-UUUU", F_STRING ,
(PTR) fax, CUG_dfmp );
/******* set all the field options ***/
sf_opt( PICSKIP , ON , CUG_fld5 );
/*** set all the field ranges ***/
/* Define field help keywords */
/* Define field begin & end functions. */
/*********************** define the menu ***************************/
/* define a menu */
CUG_mfmp = mn_def( MNSTANDARD , AUTOPLACE,AUTOPLACE,AUTOSIZE,AUTOSIZE,
LMNINACT, BDR_NULLP );
/******* define menu fields *********/
CUG_mn1 = mnf_def( 23,15," ADD ", NULLP,
NULLP, addCUG, CUG_mfmp );
CUG_mn2 = mnf_def( 23,22," DELETE ", NULLP,
NULLP, delCUG, CUG_mfmp );
CUG_mn3 = mnf_def( 23,31," EDIT ", NULLP,
NULLP, editCUG, CUG_mfmp );
CUG_mn4 = mnf_def( 23,38," FIND ", NULLP,
NULLP, findCUG, CUG_mfmp );
CUG_mn5 = mnf_def( 23,45," NEXT ", NULLP,
NULLP, nextCUG, CUG_mfmp );
CUG_mn6 = mnf_def( 23,52," PREV ", NULLP,
NULLP, prevCUG, CUG_mfmp );
CUG_mn7 = mnf_def( 23,59," QUIT ", NULLP,
NULLP, quitCUG, CUG_mfmp );
/*********** define background text */
bg_txtdef( 1, 28, "C USER'S GROUP UI2 DEMO", LNORMAL, CUG_mfmp);
bg_txtdef( 2, 28, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓", LNORMAL, CUG_mfmp);
bg_boxdef( 5,14,11,52,LNORMAL,BDR_DLNP, CUG_mfmp);
bg_txtdef( 7, 19, "Name : [ ]", LNORMAL, CUG_mfmp);
bg_txtdef( 8, 19, "Address : [ ]", LNORMAL, CUG_mfmp);
bg_txtdef( 9, 19, "City : [ ]", LNORMAL, CUG_mfmp);
bg_txtdef( 10, 19, "State : [ ] Zip : [ - ]", LNORMAL, CUG_mfmp);
bg_txtdef( 12, 19, "Phone : [ ]", LNORMAL, CUG_mfmp);
bg_txtdef( 13, 19, "Fax : [ ]", LNORMAL, CUG_mfmp);
/**************** display variables **/
/* define boxes around menu items ****/
bg_boxdef( 22,14,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,21,3,10,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,30,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,37,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,44,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,51,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
bg_boxdef( 22,58,3,8,LNORMAL,BDR_DLNP,CUG_mfmp);
/**** define trigger keys **********/
smnf_selectch( 1 , LMNSELCH, CUG_mn1 );
smnf_selectch( 1 , LMNSELCH, CUG_mn2 );
smnf_selectch( 1 , LMNSELCH, CUG_mn3 );
smnf_selectch( 1 , LMNSELCH, CUG_mn4 );
smnf_selectch( 1 , LMNSELCH, CUG_mn5 );
smnf_selectch( 1 , LMNSELCH, CUG_mn6 );
smnf_selectch( 1 , LMNSELCH, CUG_mn7 );
mn_up( CUG_mfmp ); /* display menu */
fm_up( CUG_dfmp ); /* display form */
mn_rd( 0, CUG_mfmp ); /* begin processing the menu */
fm_dn( CUG_dfmp ); /* remove form */
fm_free( CUG_dfmp ); /* Free memory allocate for form */
mn_dn( CUG_mfmp ); /* remove menu */
mn_free( CUG_mfmp ); /* free memory allocated for menu */
closeCUG(); /* close btrieve file (s) */
return 0;
}
/****************************** END